# coding: utf-8

"""
    Firefly III API Client

    This is the Python client for Firefly III API  # noqa: E501

    The version of the OpenAPI document: 0.10.0
    Contact: thegrumpydictator@gmail.com
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six


class RecurrenceUpdate(object):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    """
    Attributes:
      openapi_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    openapi_types = {
        'active': 'bool',
        'apply_rules': 'bool',
        'description': 'str',
        'first_date': 'date',
        'nr_of_repetitions': 'int',
        'piggy_bank_id': 'int',
        'repeat_until': 'date',
        'repetitions': 'list[RecurrenceRepetitionUpdate]',
        'tags': 'str',
        'title': 'str',
        'transactions': 'list[RecurrenceTransactionUpdate]',
        'type': 'str'
    }

    attribute_map = {
        'active': 'active',
        'apply_rules': 'apply_rules',
        'description': 'description',
        'first_date': 'first_date',
        'nr_of_repetitions': 'nr_of_repetitions',
        'piggy_bank_id': 'piggy_bank_id',
        'repeat_until': 'repeat_until',
        'repetitions': 'repetitions',
        'tags': 'tags',
        'title': 'title',
        'transactions': 'transactions',
        'type': 'type'
    }

    def __init__(self, active=None, apply_rules=None, description=None, first_date=None, nr_of_repetitions=None, piggy_bank_id=None, repeat_until=None, repetitions=None, tags=None, title=None, transactions=None, type=None):  # noqa: E501
        """RecurrenceUpdate - a model defined in OpenAPI"""  # noqa: E501

        self._active = None
        self._apply_rules = None
        self._description = None
        self._first_date = None
        self._nr_of_repetitions = None
        self._piggy_bank_id = None
        self._repeat_until = None
        self._repetitions = None
        self._tags = None
        self._title = None
        self._transactions = None
        self._type = None
        self.discriminator = None

        if active is not None:
            self.active = active
        if apply_rules is not None:
            self.apply_rules = apply_rules
        if description is not None:
            self.description = description
        self.first_date = first_date
        if nr_of_repetitions is not None:
            self.nr_of_repetitions = nr_of_repetitions
        if piggy_bank_id is not None:
            self.piggy_bank_id = piggy_bank_id
        self.repeat_until = repeat_until
        self.repetitions = repetitions
        if tags is not None:
            self.tags = tags
        self.title = title
        self.transactions = transactions
        self.type = type

    @property
    def active(self):
        """Gets the active of this RecurrenceUpdate.  # noqa: E501


        :return: The active of this RecurrenceUpdate.  # noqa: E501
        :rtype: bool
        """
        return self._active

    @active.setter
    def active(self, active):
        """Sets the active of this RecurrenceUpdate.


        :param active: The active of this RecurrenceUpdate.  # noqa: E501
        :type: bool
        """

        self._active = active

    @property
    def apply_rules(self):
        """Gets the apply_rules of this RecurrenceUpdate.  # noqa: E501

        Whether or not to fire the rules after the creation of a transaction.  # noqa: E501

        :return: The apply_rules of this RecurrenceUpdate.  # noqa: E501
        :rtype: bool
        """
        return self._apply_rules

    @apply_rules.setter
    def apply_rules(self, apply_rules):
        """Sets the apply_rules of this RecurrenceUpdate.

        Whether or not to fire the rules after the creation of a transaction.  # noqa: E501

        :param apply_rules: The apply_rules of this RecurrenceUpdate.  # noqa: E501
        :type: bool
        """

        self._apply_rules = apply_rules

    @property
    def description(self):
        """Gets the description of this RecurrenceUpdate.  # noqa: E501

        Not to be confused with the description of the actual transaction(s) being created.  # noqa: E501

        :return: The description of this RecurrenceUpdate.  # noqa: E501
        :rtype: str
        """
        return self._description

    @description.setter
    def description(self, description):
        """Sets the description of this RecurrenceUpdate.

        Not to be confused with the description of the actual transaction(s) being created.  # noqa: E501

        :param description: The description of this RecurrenceUpdate.  # noqa: E501
        :type: str
        """

        self._description = description

    @property
    def first_date(self):
        """Gets the first_date of this RecurrenceUpdate.  # noqa: E501

        First time the recurring transaction will fire. Must be after today.  # noqa: E501

        :return: The first_date of this RecurrenceUpdate.  # noqa: E501
        :rtype: date
        """
        return self._first_date

    @first_date.setter
    def first_date(self, first_date):
        """Sets the first_date of this RecurrenceUpdate.

        First time the recurring transaction will fire. Must be after today.  # noqa: E501

        :param first_date: The first_date of this RecurrenceUpdate.  # noqa: E501
        :type: date
        """
        if first_date is None:
            raise ValueError("Invalid value for `first_date`, must not be `None`")  # noqa: E501

        self._first_date = first_date

    @property
    def nr_of_repetitions(self):
        """Gets the nr_of_repetitions of this RecurrenceUpdate.  # noqa: E501

        Max number of created transactions. Use either this field or repeat_until.  # noqa: E501

        :return: The nr_of_repetitions of this RecurrenceUpdate.  # noqa: E501
        :rtype: int
        """
        return self._nr_of_repetitions

    @nr_of_repetitions.setter
    def nr_of_repetitions(self, nr_of_repetitions):
        """Sets the nr_of_repetitions of this RecurrenceUpdate.

        Max number of created transactions. Use either this field or repeat_until.  # noqa: E501

        :param nr_of_repetitions: The nr_of_repetitions of this RecurrenceUpdate.  # noqa: E501
        :type: int
        """

        self._nr_of_repetitions = nr_of_repetitions

    @property
    def piggy_bank_id(self):
        """Gets the piggy_bank_id of this RecurrenceUpdate.  # noqa: E501

        Piggy bank to relate the newly created transaction to. Will only work for transfers.  # noqa: E501

        :return: The piggy_bank_id of this RecurrenceUpdate.  # noqa: E501
        :rtype: int
        """
        return self._piggy_bank_id

    @piggy_bank_id.setter
    def piggy_bank_id(self, piggy_bank_id):
        """Sets the piggy_bank_id of this RecurrenceUpdate.

        Piggy bank to relate the newly created transaction to. Will only work for transfers.  # noqa: E501

        :param piggy_bank_id: The piggy_bank_id of this RecurrenceUpdate.  # noqa: E501
        :type: int
        """

        self._piggy_bank_id = piggy_bank_id

    @property
    def repeat_until(self):
        """Gets the repeat_until of this RecurrenceUpdate.  # noqa: E501

        Date until the recurring transaction can fire. Use either this field or repetitions.  # noqa: E501

        :return: The repeat_until of this RecurrenceUpdate.  # noqa: E501
        :rtype: date
        """
        return self._repeat_until

    @repeat_until.setter
    def repeat_until(self, repeat_until):
        """Sets the repeat_until of this RecurrenceUpdate.

        Date until the recurring transaction can fire. Use either this field or repetitions.  # noqa: E501

        :param repeat_until: The repeat_until of this RecurrenceUpdate.  # noqa: E501
        :type: date
        """
        if repeat_until is None:
            raise ValueError("Invalid value for `repeat_until`, must not be `None`")  # noqa: E501

        self._repeat_until = repeat_until

    @property
    def repetitions(self):
        """Gets the repetitions of this RecurrenceUpdate.  # noqa: E501


        :return: The repetitions of this RecurrenceUpdate.  # noqa: E501
        :rtype: list[RecurrenceRepetitionUpdate]
        """
        return self._repetitions

    @repetitions.setter
    def repetitions(self, repetitions):
        """Sets the repetitions of this RecurrenceUpdate.


        :param repetitions: The repetitions of this RecurrenceUpdate.  # noqa: E501
        :type: list[RecurrenceRepetitionUpdate]
        """
        if repetitions is None:
            raise ValueError("Invalid value for `repetitions`, must not be `None`")  # noqa: E501

        self._repetitions = repetitions

    @property
    def tags(self):
        """Gets the tags of this RecurrenceUpdate.  # noqa: E501

        Tags to be used for each created transaction, comma separated.  # noqa: E501

        :return: The tags of this RecurrenceUpdate.  # noqa: E501
        :rtype: str
        """
        return self._tags

    @tags.setter
    def tags(self, tags):
        """Sets the tags of this RecurrenceUpdate.

        Tags to be used for each created transaction, comma separated.  # noqa: E501

        :param tags: The tags of this RecurrenceUpdate.  # noqa: E501
        :type: str
        """

        self._tags = tags

    @property
    def title(self):
        """Gets the title of this RecurrenceUpdate.  # noqa: E501


        :return: The title of this RecurrenceUpdate.  # noqa: E501
        :rtype: str
        """
        return self._title

    @title.setter
    def title(self, title):
        """Sets the title of this RecurrenceUpdate.


        :param title: The title of this RecurrenceUpdate.  # noqa: E501
        :type: str
        """
        if title is None:
            raise ValueError("Invalid value for `title`, must not be `None`")  # noqa: E501

        self._title = title

    @property
    def transactions(self):
        """Gets the transactions of this RecurrenceUpdate.  # noqa: E501


        :return: The transactions of this RecurrenceUpdate.  # noqa: E501
        :rtype: list[RecurrenceTransactionUpdate]
        """
        return self._transactions

    @transactions.setter
    def transactions(self, transactions):
        """Sets the transactions of this RecurrenceUpdate.


        :param transactions: The transactions of this RecurrenceUpdate.  # noqa: E501
        :type: list[RecurrenceTransactionUpdate]
        """
        if transactions is None:
            raise ValueError("Invalid value for `transactions`, must not be `None`")  # noqa: E501

        self._transactions = transactions

    @property
    def type(self):
        """Gets the type of this RecurrenceUpdate.  # noqa: E501


        :return: The type of this RecurrenceUpdate.  # noqa: E501
        :rtype: str
        """
        return self._type

    @type.setter
    def type(self, type):
        """Sets the type of this RecurrenceUpdate.


        :param type: The type of this RecurrenceUpdate.  # noqa: E501
        :type: str
        """
        if type is None:
            raise ValueError("Invalid value for `type`, must not be `None`")  # noqa: E501
        allowed_values = ["withdrawal", "deposit", "transfer"]  # noqa: E501
        if type not in allowed_values:
            raise ValueError(
                "Invalid value for `type` ({0}), must be one of {1}"  # noqa: E501
                .format(type, allowed_values)
            )

        self._type = type

    def to_dict(self):
        """Returns the model properties as a dict"""
        result = {}

        for attr, _ in six.iteritems(self.openapi_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value

        return result

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.pformat(self.to_dict())

    def __repr__(self):
        """For `print` and `pprint`"""
        return self.to_str()

    def __eq__(self, other):
        """Returns true if both objects are equal"""
        if not isinstance(other, RecurrenceUpdate):
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """Returns true if both objects are not equal"""
        return not self == other
